﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Styx;
using Styx.Common;
using Styx.CommonBot.Inventory;
using Styx.Helpers;
using DefaultValue = Styx.Helpers.DefaultValueAttribute;

namespace EtherealTheory.Honorbuddy.Plugins
{
    public partial class ImmediateForm : Form
    {
        public ImmediateForm()
        {
            InitializeComponent();
        }

        protected override void OnLoad(EventArgs e)
        {
            base.OnLoad(e);
            settingsPropertyGrid.SelectedObject = ImmediateSettings.Singleton;
            settingsPropertyGrid.PropertyValueChanged += settingsPropertyGrid_PropertyValueChanged;
        }

        void settingsPropertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e)
        {
            ImmediateSettings.Singleton.Save();
        }
    }

    public class ImmediateSettings : Settings
    {
        static ImmediateSettings()
        {
        }

        private ImmediateSettings()
            : base(Path.Combine(Path.Combine(Utilities.AssemblyDirectory, "Settings"), string.Format("ImmediateSettings_{0}.xml", StyxWoW.Me.Name)))
        {
        }


        private static readonly ImmediateSettings _singleton = new ImmediateSettings();
        public static ImmediateSettings Singleton
        {
            get
            {
                return _singleton;
            }
        }

        [Setting]
        [DefaultValue(true)]
        [Category("Combat Actions")]
        [DisplayName("Combat Looting")]
        [Description("Toggles whether or not you will immediately loot anything close to you while in combat.")]
        public bool CombatLooting { get; set; }

        [Setting]
        [DefaultValue(true)]
        [Category("Inventory Actions")]
        [DisplayName("Inventory Restacking")]
        [Description("Toggles whether or not you will restack incomplete stacks in your inventory.")]
        public bool InventoryRestacking { get; set; }

        [Setting]
        [DefaultValue(true)]
        [Category("Inventory Actions")]
        [DisplayName("Inventory Tidying")]
        [Description("Toggles whether or not you will tidy your inventory including opening & filling containers.")]
        public bool InventoryTidying { get; set; }
    }
}
